package com.slz3.business.module.configManagement.conIndexVideo.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.configManagement.conIndexVideo.domain.ConIndexVideo;
import com.slz3.business.module.configManagement.conIndexVideo.domain.ConIndexVideoFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class ConIndexVideoTransactionalServiceImpl implements ConIndexVideoTransactionalService {

    @Override
    public ConIndexVideo modify(ConIndexVideo conIndexVideoNew) {
        Repositorys.conIndexVideo.test();
        Repositorys.conIndexVideo.save(ConIndexVideoFactory.initBaseFields());
        System.err.println(1/0);
        conIndexVideoNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.conIndexVideo.saveAndFlush(conIndexVideoNew);
    }

    @Override
    public List<ConIndexVideo> batchModify(List<ConIndexVideo> conIndexVideoList) {
        return Repositorys.conIndexVideo.saveAll(conIndexVideoList);
    }
}
